/*
 * bsp_flash.h
 *
 *  Created on: 2025 Feb 6
 *      Author: SFLY
 */

#ifndef MOTOR_SOURCE_HW_DRIVERS_BSP_FLASH_H_
#define MOTOR_SOURCE_HW_DRIVERS_BSP_FLASH_H_
#include "driverlib.h"
#include "bsp_board_config.h"
/*********电机需要保存到flash的参数及地址*************/
#define SECTOR_NUM                                255
#define MOTOR_ID_ADDR                             (0x300FF000U)
#define MOTOR_ELEC_OFFSET_ADDR                    MOTOR_ID_ADDR+32
#define MOTOR_POS_TORQUR_KP_ADDR                  MOTOR_ID_ADDR+64
#define MOTOR_POS_TORQUR_KD_ADDR                  MOTOR_ID_ADDR+96
#define MOTOR_SPEED_KP_ADDR                       MOTOR_ID_ADDR+128
#define MOTOR_SPEED_KI_ADDR                       MOTOR_ID_ADDR+160
#define MOTOR_POS_KP_ADDR                         MOTOR_ID_ADDR+192
#define MOTOR_POS_KI_ADDR                         MOTOR_ID_ADDR+224
#define MOTOR_POS_KD_ADDR                         MOTOR_ID_ADDR+256
#define MOTOR_CUR_KP_ADDR                         MOTOR_ID_ADDR+288
#define MOTOR_CUR_KI_ADDR                         MOTOR_ID_ADDR+320
#define MOTOR_MECH_OFFSET_ADDR                    MOTOR_ID_ADDR+352
#define REDUCER_MECH_OFFSET_ADDR                  MOTOR_ID_ADDR+384
#define MOTOR_LIMIT_CUR_MAX_ADDR                  MOTOR_ID_ADDR+416
#define MOTOR_LIMIT_SPD_MAX_ADDR                  MOTOR_ID_ADDR+448
#define MOTOR_IS_CALIBRATION_ADDR                 MOTOR_ID_ADDR+512
#define MOTOR_SIGNFLAG_ADDR                       MOTOR_ID_ADDR+544
#define MOTOR_ORDERDIR_ADDR                       MOTOR_ID_ADDR+576
#define REDUCER_ORDERDIR_ADDR                     MOTOR_ID_ADDR+608
#define MASTER_CANID_ADDR                         MOTOR_ID_ADDR+640
/*********编码器偏差值需要保存到flash的参数及地址*************/
#define LUT_SECTOR_NUM                           254
#define LUT_ADDR                                 (0x300FE000U)


#endif /* MOTOR_SOURCE_HW_DRIVERS_BSP_FLASH_H_ */
